.class public Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;
.super Landroid/support/v4/app/FragmentStatePagerAdapter;
.source "CommunityMainAdapter.java"


# instance fields
.field private mFragments:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Landroid/support/v4/app/FragmentManager;Ljava/util/List;)V
    .registers 6
    .param p1, "fm"    # Landroid/support/v4/app/FragmentManager;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/support/v4/app/FragmentManager;",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 30
    .local p2, "types":Ljava/util/List;, "Ljava/util/List<Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;>;"
    invoke-direct {p0, p1}, Landroid/support/v4/app/FragmentStatePagerAdapter;-><init>(Landroid/support/v4/app/FragmentManager;)V

    .line 27
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    .line 31
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_b
    invoke-interface {p2}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_8f

    .line 32
    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    sget-object v2, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;->Type_Fav:Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    if-ne v1, v2, :cond_2b

    .line 33
    iget-object v2, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    invoke-static {v1}, Lcom/brixd/niceapp/community/CommunityAppGridFragment;->getInstance(Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;)Lcom/brixd/niceapp/community/CommunityAppGridFragment;

    move-result-object v1

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 31
    :goto_28
    add-int/lit8 v0, v0, 0x1

    goto :goto_b

    .line 34
    :cond_2b
    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    sget-object v2, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;->Type_App_Ranking:Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    if-ne v1, v2, :cond_3d

    .line 35
    iget-object v1, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-static {}, Lcom/brixd/niceapp/community/CommunityAppRankingFragment;->getInstance()Lcom/brixd/niceapp/community/CommunityAppRankingFragment;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_28

    .line 36
    :cond_3d
    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    sget-object v2, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;->Type_Hot:Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    if-ne v1, v2, :cond_4f

    .line 37
    iget-object v1, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-static {}, Lcom/brixd/niceapp/community/PortalFragment;->getInstance()Lcom/brixd/niceapp/community/PortalFragment;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_28

    .line 38
    :cond_4f
    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    sget-object v2, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;->Type_New:Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    if-ne v1, v2, :cond_67

    .line 39
    iget-object v2, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    invoke-static {v1}, Lcom/brixd/niceapp/community/CommunityNewAppListFragment;->getInstance(Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;)Lcom/brixd/niceapp/community/CommunityNewAppListFragment;

    move-result-object v1

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_28

    .line 40
    :cond_67
    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    sget-object v2, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;->Type_Testing:Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    if-ne v1, v2, :cond_7f

    .line 41
    iget-object v2, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    invoke-static {v1}, Lcom/brixd/niceapp/community/CommunityTestingAppListFragment;->getInstance(Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;)Lcom/brixd/niceapp/community/CommunityTestingAppListFragment;

    move-result-object v1

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_28

    .line 43
    :cond_7f
    iget-object v2, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;

    invoke-static {v1}, Lcom/brixd/niceapp/community/CommunityAppListFragment;->getInstance(Lcom/brixd/niceapp/community/AbsCommunityBaseFragment$AppListType;)Lcom/brixd/niceapp/community/CommunityAppListFragment;

    move-result-object v1

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_28

    .line 46
    :cond_8f
    return-void
.end method

.method private validatePosition(I)Z
    .registers 3
    .param p1, "position"    # I

    .prologue
    .line 65
    if-ltz p1, :cond_a

    invoke-virtual {p0}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->getCount()I

    move-result v0

    if-ge p1, v0, :cond_a

    const/4 v0, 0x1

    :goto_9
    return v0

    :cond_a
    const/4 v0, 0x0

    goto :goto_9
.end method


# virtual methods
.method public delApp(ILcom/brixd/niceapp/community/model/CommunityAppModel;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "delModel"    # Lcom/brixd/niceapp/community/model/CommunityAppModel;

    .prologue
    .line 109
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 110
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 111
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->delApp(Lcom/brixd/niceapp/community/model/CommunityAppModel;)V

    .line 114
    :cond_1b
    return-void
.end method

.method public editApp(ILcom/brixd/niceapp/community/model/CommunityAppModel;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "editModel"    # Lcom/brixd/niceapp/community/model/CommunityAppModel;

    .prologue
    .line 122
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 123
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 124
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->editApp(Lcom/brixd/niceapp/community/model/CommunityAppModel;)V

    .line 127
    :cond_1b
    return-void
.end method

.method public favStatusChanged(ILcom/brixd/niceapp/community/model/CommunityAppModel;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "sourceModel"    # Lcom/brixd/niceapp/community/model/CommunityAppModel;

    .prologue
    .line 147
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 148
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 149
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->favStatusChanged(Lcom/brixd/niceapp/community/model/CommunityAppModel;)V

    .line 152
    :cond_1b
    return-void
.end method

.method public getCount()I
    .registers 2

    .prologue
    .line 61
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Landroid/support/v4/app/Fragment;
    .registers 3
    .param p1, "position"    # I

    .prologue
    .line 56
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/support/v4/app/Fragment;

    return-object v0
.end method

.method public getPageTitle(I)Ljava/lang/CharSequence;
    .registers 5
    .param p1, "position"    # I

    .prologue
    .line 50
    iget-object v1, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v1, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/activity/fragment/AbsBaseTitleFragment;

    .line 51
    .local v0, "fragment":Lcom/brixd/niceapp/activity/fragment/AbsBaseTitleFragment;
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0}, Lcom/brixd/niceapp/activity/fragment/AbsBaseTitleFragment;->getFragmentTitle()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    return-object v1
.end method

.method public refreshAppList(I)V
    .registers 3
    .param p1, "position"    # I

    .prologue
    .line 76
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_11

    .line 77
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;

    invoke-virtual {v0}, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;->refreshList()V

    .line 79
    :cond_11
    return-void
.end method

.method public scrollToHome(I)V
    .registers 3
    .param p1, "position"    # I

    .prologue
    .line 82
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_11

    .line 83
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;

    invoke-virtual {v0}, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;->scrollToHome()V

    .line 85
    :cond_11
    return-void
.end method

.method public setHeaderView(ILandroid/view/View;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "headerView"    # Landroid/view/View;

    .prologue
    .line 70
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_11

    .line 71
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/AbsCommunityBaseFragment;->setHeaderView(Landroid/view/View;)V

    .line 73
    :cond_11
    return-void
.end method

.method public setOnScrollListener(ILandroid/widget/AbsListView$OnScrollListener;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "listener"    # Landroid/widget/AbsListView$OnScrollListener;

    .prologue
    .line 88
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 89
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 90
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 93
    :cond_1b
    return-void
.end method

.method public setOnTouchListener(ILandroid/view/View$OnTouchListener;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "listener"    # Landroid/view/View$OnTouchListener;

    .prologue
    .line 96
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 97
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 98
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 101
    :cond_1b
    return-void
.end method

.method public updateBottomNums(ILcom/brixd/niceapp/community/model/CommunityAppModel;)V
    .registers 4
    .param p1, "position"    # I
    .param p2, "editModel"    # Lcom/brixd/niceapp/community/model/CommunityAppModel;

    .prologue
    .line 135
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->validatePosition(I)Z

    move-result v0

    if-eqz v0, :cond_1b

    .line 136
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    instance-of v0, v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    if-eqz v0, :cond_1b

    .line 137
    iget-object v0, p0, Lcom/brixd/niceapp/community/adapter/CommunityMainAdapter;->mFragments:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;

    invoke-virtual {v0, p2}, Lcom/brixd/niceapp/community/CommunityAppBaseFragment;->updateBottomNums(Lcom/brixd/niceapp/community/model/CommunityAppModel;)V

    .line 140
    :cond_1b
    return-void
.end method
